package common;

import model.room.Room;

import java.io.*;
import java.util.ArrayList;
import java.util.List;


//序列化Room，在文件中写入多个Room
public class initRoom {
    public static void main(String[] args) {

        //十个单人间
        Room.getRooms().add(new Room("1001",100, RoomState.EMPTY, RoomTypes.Single_ROOM));
        Room.getRooms().add(new Room("1002",100, RoomState.EMPTY, RoomTypes.Single_ROOM));
        Room.getRooms().add(new Room("1003",100, RoomState.EMPTY, RoomTypes.Single_ROOM));
        Room.getRooms().add(new Room("1004",100, RoomState.EMPTY, RoomTypes.Single_ROOM));
        Room.getRooms().add(new Room("1005",100, RoomState.EMPTY, RoomTypes.Single_ROOM));
        Room.getRooms().add(new Room("1006",100, RoomState.EMPTY, RoomTypes.Single_ROOM));
        Room.getRooms().add(new Room("1007",100, RoomState.EMPTY, RoomTypes.Single_ROOM));
        Room.getRooms().add(new Room("1008",100, RoomState.EMPTY, RoomTypes.Single_ROOM));
        Room.getRooms().add(new Room("1009",100, RoomState.EMPTY, RoomTypes.Single_ROOM));
        Room.getRooms().add(new Room("1010",100, RoomState.EMPTY, RoomTypes.Single_ROOM));

        //十个双人间
        Room.getRooms().add(new Room("2001",150, RoomState.EMPTY, RoomTypes.Twin_ROOM));
        Room.getRooms().add(new Room("2002",150, RoomState.EMPTY, RoomTypes.Twin_ROOM));
        Room.getRooms().add(new Room("2003",150, RoomState.EMPTY, RoomTypes.Twin_ROOM));
        Room.getRooms().add(new Room("2004",150, RoomState.EMPTY, RoomTypes.Twin_ROOM));
        Room.getRooms().add(new Room("2005",150, RoomState.EMPTY, RoomTypes.Twin_ROOM));
        Room.getRooms().add(new Room("2006",150, RoomState.EMPTY, RoomTypes.Twin_ROOM));
        Room.getRooms().add(new Room("2007",150, RoomState.EMPTY, RoomTypes.Twin_ROOM));
        Room.getRooms().add(new Room("2008",150, RoomState.EMPTY, RoomTypes.Twin_ROOM));
        Room.getRooms().add(new Room("2009",150, RoomState.EMPTY, RoomTypes.Twin_ROOM));
        Room.getRooms().add(new Room("2010",150, RoomState.EMPTY, RoomTypes.Twin_ROOM));

        //十个大床房
        Room.getRooms().add(new Room("3001",200, RoomState.EMPTY, RoomTypes.Double_ROOM));
        Room.getRooms().add(new Room("3002",200, RoomState.EMPTY, RoomTypes.Double_ROOM));
        Room.getRooms().add(new Room("3003",200, RoomState.EMPTY, RoomTypes.Double_ROOM));
        Room.getRooms().add(new Room("3004",200, RoomState.EMPTY, RoomTypes.Double_ROOM));
        Room.getRooms().add(new Room("3005",200, RoomState.EMPTY, RoomTypes.Double_ROOM));
        Room.getRooms().add(new Room("3006",200, RoomState.EMPTY, RoomTypes.Double_ROOM));
        Room.getRooms().add(new Room("3007",200, RoomState.EMPTY, RoomTypes.Double_ROOM));
        Room.getRooms().add(new Room("3008",200, RoomState.EMPTY, RoomTypes.Double_ROOM));
        Room.getRooms().add(new Room("3009",200, RoomState.EMPTY, RoomTypes.Double_ROOM));
        Room.getRooms().add(new Room("3010",200, RoomState.EMPTY, RoomTypes.Double_ROOM));

        //十个豪华大床间
        Room.getRooms().add(new Room("4001",399, RoomState.EMPTY, RoomTypes.Deluxe_ROOM));
        Room.getRooms().add(new Room("4002",399, RoomState.EMPTY, RoomTypes.Deluxe_ROOM));
        Room.getRooms().add(new Room("4003",399, RoomState.EMPTY, RoomTypes.Deluxe_ROOM));
        Room.getRooms().add(new Room("4004",399, RoomState.EMPTY, RoomTypes.Deluxe_ROOM));
        Room.getRooms().add(new Room("4005",399, RoomState.EMPTY, RoomTypes.Deluxe_ROOM));
        Room.getRooms().add(new Room("4006",399, RoomState.EMPTY, RoomTypes.Deluxe_ROOM));
        Room.getRooms().add(new Room("4007",399, RoomState.EMPTY, RoomTypes.Deluxe_ROOM));
        Room.getRooms().add(new Room("4008",399, RoomState.EMPTY, RoomTypes.Deluxe_ROOM));
        Room.getRooms().add(new Room("4009",399, RoomState.EMPTY, RoomTypes.Deluxe_ROOM));
        Room.getRooms().add(new Room("4010",399, RoomState.EMPTY, RoomTypes.Deluxe_ROOM));

        //将Rooms集合保存在指定文件中
        String filename = "project/src/common/Rooms.txt";  //文件路径

        try (ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(filename))) {
            out.writeObject(Room.getRooms());
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}